package com.dk.mq;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dk.pojo.user.TbUser;
import com.dk.service.seckill.SeckillGoodsService;
import com.dk.service.seckill.SekillIdAndUserId;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = "sekillOrder",consumerGroup = "consumer-sekillOrder")
public class SekillOrderMQCousumer implements RocketMQListener<SekillIdAndUserId> {

    @Reference
    private SeckillGoodsService seckillGoodsService;

    @Override
    public void onMessage(SekillIdAndUserId sekillIdAndUserId) {
        seckillGoodsService.saveOrder(sekillIdAndUserId.getId(),sekillIdAndUserId.getUserId());
    }
}
